# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-net-libdnet
_cpanname=Net-Libdnet
pkgver=0.99
pkgrel=8
pkgdesc="Binding for Dug Song's libdnet."
arch=('x86_64' 'aarch64')
url='https://metacpan.org/release/Net-Libdnet'
license=('GPL' 'PerlArtistic')
depends=('perl' 'perl-class-gomor' 'libdnet')
makedepends=('perl-extutils-makemaker')
options=('!emptydirs')
source=("http://www.cpan.org/authors/id/G/GO/GOMOR/$_cpanname-$pkgver.tar.gz"
        'lengths.patch')
sha512sums=('fe62a7f59cf752fb6dd05233b83773ecd98db4b5cce447ba6c8fdbe4a173a061487003274eaf3ee6c1da5dc6a9da55f10ba021cb5b2140b673fa7bcd91a2f0c5'
            '4e90c52275114ef68e3972fba56ef147dbcc21302cf49969aaf88f9ac1b3395ba44f8f801b54054598f958bf0f8760d3205f939793a209d63f82547de8c63084')

prepare() {
  cd "$_cpanname-$pkgver"

  patch -Np2 -b -z .orig<../lengths.patch

  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
    PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
    MODULEBUILDRC=/dev/null

  /usr/bin/perl Makefile.PL
}

build() {
  cd "$_cpanname-$pkgver"

  make
}

package() {
  cd "$_cpanname-$pkgver"

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

